package myString;

/**
 * @author Raymond
 * @create 2025/4/22 14:39
 */
public class StringBufferExc {
    public static void main(String[] args) {
        //12345.6  -> 12,345.6
        String str = "6612345.6";
        StringBuffer stringBuffer = new StringBuffer(str);
        for (int i = stringBuffer.lastIndexOf(".")-3; i > 0; i-=3) {
            stringBuffer.insert(i,",");
        }
        System.out.println("stringBuffer.toString() = " + stringBuffer.toString());
    }
}
